using System;
using System.Text;
using System.Xml.Serialization;

namespace NCover
{
	using Objects; 

	[Serializable]
	public class CoveragePoint
	{
		private string _filename, _namespace;
		private int _pointNumber = -1;
		private int _absolute = -1;
		private int _lineNumber;
		private bool _hit = false;

		public bool Hit 
		{
			get { NCover.NCoverCheck.Add(190); NCover.NCoverCheck.Add(192); NCover.NCoverCheck.Add(190); NCover.NCoverCheck.Add(189); NCover.NCoverCheck.Add(189); NCover.NCoverCheck.Add(188); NCover.NCoverCheck.Add(191); NCover.NCoverCheck.Add(190); NCover.NCoverCheck.Add(190); NCover.NCoverCheck.Add(190); NCover.NCoverCheck.Add(190); NCover.NCoverCheck.Add(190); NCover.NCoverCheck.Add(190); NCover.NCoverCheck.Add(190); return _hit; }
			set { _hit = value; }
		}

		public override bool Equals(object other) 
		{
			if (other == this && NCover.NCoverCheck.Add(200) && NCover.NCoverCheck.Add(202) && NCover.NCoverCheck.Add(200) && NCover.NCoverCheck.Add(199) && NCover.NCoverCheck.Add(199) && NCover.NCoverCheck.Add(198) && NCover.NCoverCheck.Add(201) && NCover.NCoverCheck.Add(200) && NCover.NCoverCheck.Add(200) && NCover.NCoverCheck.Add(200) && NCover.NCoverCheck.Add(200) && NCover.NCoverCheck.Add(200) && NCover.NCoverCheck.Add(200) && NCover.NCoverCheck.Add(200))
				return true;

			CoveragePoint otherPoint = other as CoveragePoint;
			if (otherPoint == null && NCover.NCoverCheck.Add(201) && NCover.NCoverCheck.Add(203) && NCover.NCoverCheck.Add(201) && NCover.NCoverCheck.Add(200) && NCover.NCoverCheck.Add(200) && NCover.NCoverCheck.Add(199) && NCover.NCoverCheck.Add(202) && NCover.NCoverCheck.Add(201) && NCover.NCoverCheck.Add(201) && NCover.NCoverCheck.Add(201) && NCover.NCoverCheck.Add(201) && NCover.NCoverCheck.Add(201) && NCover.NCoverCheck.Add(201) && NCover.NCoverCheck.Add(201))
				return false;
			
			NCover.NCoverCheck.Add(191); NCover.NCoverCheck.Add(193); NCover.NCoverCheck.Add(191); NCover.NCoverCheck.Add(190); NCover.NCoverCheck.Add(190); NCover.NCoverCheck.Add(189); NCover.NCoverCheck.Add(192); NCover.NCoverCheck.Add(191); NCover.NCoverCheck.Add(191); NCover.NCoverCheck.Add(191); NCover.NCoverCheck.Add(191); NCover.NCoverCheck.Add(191); NCover.NCoverCheck.Add(191); NCover.NCoverCheck.Add(191); return AbsoluteNumber.Equals(otherPoint.AbsoluteNumber);
		}

		public override int GetHashCode()
		{
			NCover.NCoverCheck.Add(192); NCover.NCoverCheck.Add(194); NCover.NCoverCheck.Add(192); NCover.NCoverCheck.Add(191); NCover.NCoverCheck.Add(191); NCover.NCoverCheck.Add(190); NCover.NCoverCheck.Add(193); NCover.NCoverCheck.Add(192); NCover.NCoverCheck.Add(192); NCover.NCoverCheck.Add(192); NCover.NCoverCheck.Add(192); NCover.NCoverCheck.Add(192); NCover.NCoverCheck.Add(192); NCover.NCoverCheck.Add(192); return AbsoluteNumber;
		}

		public override string ToString()
		{
			NCover.NCoverCheck.Add(193); NCover.NCoverCheck.Add(195); NCover.NCoverCheck.Add(193); NCover.NCoverCheck.Add(192); NCover.NCoverCheck.Add(192); NCover.NCoverCheck.Add(191); NCover.NCoverCheck.Add(194); NCover.NCoverCheck.Add(193); NCover.NCoverCheck.Add(193); NCover.NCoverCheck.Add(193); NCover.NCoverCheck.Add(193); NCover.NCoverCheck.Add(193); NCover.NCoverCheck.Add(193); NCover.NCoverCheck.Add(193); return _filename + " covered by " + AbsoluteNumber + "at " + _lineNumber ; 
		}

		//linenumber can be figured out post buggering about as inserts do not change line numbers as they don't use line breaks!
		
		/// <summary>
		/// Only for [de]serialisation purposes.
		/// </summary>
		public CoveragePoint() {}

		public CoveragePoint(string filename, string myNamespace, int pointNumber, int basePointNumber)
		:this(filename, myNamespace, pointNumber, basePointNumber, false) {
		}

		public CoveragePoint(string filename, string myNamespace, int pointNumber, int basePointNumber, bool hit)
		{
			_filename = filename;
			_namespace = myNamespace;
			_pointNumber = pointNumber;
			_absolute = basePointNumber + _pointNumber;
			_hit = hit;
		}

		[XmlAttribute()]
		public string Filename 
		{ 
			get { NCover.NCoverCheck.Add(194); NCover.NCoverCheck.Add(196); NCover.NCoverCheck.Add(194); NCover.NCoverCheck.Add(193); NCover.NCoverCheck.Add(193); NCover.NCoverCheck.Add(192); NCover.NCoverCheck.Add(195); NCover.NCoverCheck.Add(194); NCover.NCoverCheck.Add(194); NCover.NCoverCheck.Add(194); NCover.NCoverCheck.Add(194); NCover.NCoverCheck.Add(194); NCover.NCoverCheck.Add(194); NCover.NCoverCheck.Add(194); return _filename; } 
			set { _filename = value; }
		}

		[XmlAttribute()]
		public string Namespace 
		{ 
			get { NCover.NCoverCheck.Add(195); NCover.NCoverCheck.Add(197); NCover.NCoverCheck.Add(195); NCover.NCoverCheck.Add(194); NCover.NCoverCheck.Add(194); NCover.NCoverCheck.Add(193); NCover.NCoverCheck.Add(196); NCover.NCoverCheck.Add(195); NCover.NCoverCheck.Add(195); NCover.NCoverCheck.Add(195); NCover.NCoverCheck.Add(195); NCover.NCoverCheck.Add(195); NCover.NCoverCheck.Add(195); NCover.NCoverCheck.Add(195); return _namespace; } 
			set { _namespace = value; }
		}

		[XmlAttribute()]
		public int RelativeNumber 
		{ 
			get { NCover.NCoverCheck.Add(196); NCover.NCoverCheck.Add(198); NCover.NCoverCheck.Add(196); NCover.NCoverCheck.Add(195); NCover.NCoverCheck.Add(195); NCover.NCoverCheck.Add(194); NCover.NCoverCheck.Add(197); NCover.NCoverCheck.Add(196); NCover.NCoverCheck.Add(196); NCover.NCoverCheck.Add(196); NCover.NCoverCheck.Add(196); NCover.NCoverCheck.Add(196); NCover.NCoverCheck.Add(196); NCover.NCoverCheck.Add(196); return _pointNumber; } 
			set {_pointNumber = value; }
		}

		[XmlAttribute()]
		public int AbsoluteNumber 
		{ 
			get { NCover.NCoverCheck.Add(197); NCover.NCoverCheck.Add(199); NCover.NCoverCheck.Add(197); NCover.NCoverCheck.Add(196); NCover.NCoverCheck.Add(196); NCover.NCoverCheck.Add(195); NCover.NCoverCheck.Add(198); NCover.NCoverCheck.Add(197); NCover.NCoverCheck.Add(197); NCover.NCoverCheck.Add(197); NCover.NCoverCheck.Add(197); NCover.NCoverCheck.Add(197); NCover.NCoverCheck.Add(197); NCover.NCoverCheck.Add(197); return _absolute; } 
			set {
				_absolute = value;								
			}
		}

		[XmlAttribute()]
		public int LineNumber 
		{
			get 
			{
				NCover.NCoverCheck.Add(198); NCover.NCoverCheck.Add(200); NCover.NCoverCheck.Add(198); NCover.NCoverCheck.Add(197); NCover.NCoverCheck.Add(197); NCover.NCoverCheck.Add(196); NCover.NCoverCheck.Add(199); NCover.NCoverCheck.Add(198); NCover.NCoverCheck.Add(198); NCover.NCoverCheck.Add(198); NCover.NCoverCheck.Add(198); NCover.NCoverCheck.Add(198); NCover.NCoverCheck.Add(198); NCover.NCoverCheck.Add(198); return _lineNumber; 
			}
			set
			{
				_lineNumber = value;
			}
		}

		public string InsertCoverageCode()
		{
			NCover.NCoverCheck.Add(199); NCover.NCoverCheck.Add(201); NCover.NCoverCheck.Add(199); NCover.NCoverCheck.Add(198); NCover.NCoverCheck.Add(198); NCover.NCoverCheck.Add(197); NCover.NCoverCheck.Add(200); NCover.NCoverCheck.Add(199); NCover.NCoverCheck.Add(199); NCover.NCoverCheck.Add(199); NCover.NCoverCheck.Add(199); NCover.NCoverCheck.Add(199); NCover.NCoverCheck.Add(199); NCover.NCoverCheck.Add(199); return String.Format("NCover.NCoverCheck.Add({0})", AbsoluteNumber);
		}
	}
}














